#ifndef _CTEST_REPORT_H_
#define _CTEST_REPORT_H_
#include <QString>
#include <QVector>
#include <stdbool.h>
#include <stdint.h>

class CTestReport {
public:
  typedef struct EventInfo {
    uint32_t id;       // 雷达触发的帧号
    uint32_t type;     // 雷达触发的类型：0：入场，1：出场
    QString plate_num; // 车牌号
  } EventInfo_t;

  typedef struct AlgResultTestInfo {
    QString file;
    uint32_t mark_in_cnt = 0;
    uint32_t mark_out_cnt = 0;
    uint32_t trig_in_cnt = 0;
    uint32_t trig_out_cnt = 0;
    uint32_t trig_in_diff = 0;
    uint32_t trig_out_diff = 0;
    uint32_t miss_trig_cnt = 0;
    uint32_t false_trig_cnt = 0;
    uint32_t late_trig_in_cnt = 0;
    uint32_t late_trig_out_cnt = 0;
  } AlgResultTestInfo_t;

public:
  CTestReport();
  ~CTestReport();

public:
  int ClearAll();
  int AddTestResult(QString file, QVector<EventInfo_t> &resl);
  int MakeReport(QString file);
  int GetMarkInfo(QString file, QVector<EventInfo_t> &info);
  int MakeChart(QString file_chart, QVector<uint32_t> &radar_data,
                QVector<EventInfo_t> &mark, QVector<EventInfo_t> &resl);

private:
  QVector<AlgResultTestInfo_t> result_info_;

private:
  int WriteMarkInfoToAlgResult(AlgResultTestInfo_t *info,
                               QVector<EventInfo_t> mark);
  int WriteAlgInfoToAlgResult(AlgResultTestInfo_t *info,
                              QVector<EventInfo_t> alg);
  int WriteTestResult(AlgResultTestInfo_t *info, QVector<EventInfo_t> resl,
                      QVector<EventInfo_t> alg);
  QString MakeTableHead();
  QString MakeTableContent(AlgResultTestInfo_t *resul_sum);
  QString MakeTableTotal(AlgResultTestInfo_t *resul_sum);
};

#endif
